Skip to content

Conversation

addaleax
Copy link
Contributor

@addaleax addaleax commented Aug 19, 2025

This is bordering on something we should consider an unsupported configuration, but since we know this is a real-world setup of some customers, let's try to support it.


Before this change, our OIDC plugin could exhibit undesirable behavior in a
specific configuration edge case, which, unfortunately, matches the default
behavior of at least one identity provider software.

Specifically, Ping Identity software does not typically provide us with
JWTs that are usable for authentication and authorization, so users may
opt to use ID tokens instead. Ping, however, by default does not provide
clients with new ID tokens on a refresh operations, and also only gives
those tokens a default validity of 5 minutes.

(We do recommend to Ping customers to enable passing new ID tokens on
refresh if they have this setup.)

However, 5 minutes also happens to be the time at which the plugin
prefers either refreshing tokens or prompting the user for re-authentication
instead of re-using tokens with a short leftover validity.

This means that when the driver requests a new token multiple times, or
multiple driver instances request tokens in quick succession (which can
easily happen, especially if they used the same token beforehand, which
obviously then expires at around the same time for each driver), the
plugin would try to refresh the token, then when that failed, prompt
the user for a new authentication attempt not just once every minutes,
but multiple times in quick succession as well.

To avoid this issue, we refactor the code that chooses a token acquisition
mechanism so that even if the current token still has a leftover validity
of less than 5 minutes and refreshing fails, we still keep using it until
the driver signals to us that it has become fully unusable.

@addaleax addaleax marked this pull request as draft August 19, 2025 00:16
@github-actions github-actions bot added fix and removed fix labels Aug 19, 2025
@addaleax addaleax force-pushed the 2498-dev branch 2 times, most recently from d188b15 to 2fa9d4a Compare September 9, 2025 17:22
…-2498

Before this change, our OIDC plugin could exhibit undesirable behavior in a
specific configuration edge case, which, unfortunately, matches the default
behavior of at least one identity provider software.

Specifically, Ping Identity software does not typically provide us with
JWTs that are usable for authentication and authorization, so users may
opt to use ID tokens instead. Ping, however, by default does not provide
clients with new ID tokens on a refresh operations, and also only gives
those tokens a default validity of 5 minutes.

(We do recommend to Ping customers to enable passing new ID tokens on
refresh if they have this setup.)

However, 5 minutes also happens to be the time at which the plugin
prefers either refreshing tokens or prompting the user for re-authentication
instead of re-using tokens with a short leftover validity.

This means that when the driver requests a new token multiple times, or
multiple driver instances request tokens in quick succession (which can
easily happen, especially if they used the same token beforehand, which
obviously then expires at around the same time for each driver), the
plugin would try to refresh the token, then when that failed, prompt
the user for a new authentication attempt not just once every minutes,
but multiple times in quick succession as well.

To avoid this issue, we refactor the code that chooses a token acquisition
mechanism so that even if the current token still has a leftover validity
of less than 5 minutes and refreshing fails, we still keep using it until
the driver signals to us that it has become fully unusable.
@addaleax addaleax marked this pull request as ready for review September 9, 2025 17:23
@github-actions github-actions bot added fix and removed fix labels Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant